home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ham Radio 2000
/
Ham Radio 2000.iso
/
ham2000
/
packet
/
p_tapr
/
tnchst
/
dlc.inc
< prev
next >
Wrap
Text File
|
1991-02-12
|
2KB
|
94 lines
#ifndef DLC_INCLUDES
#define DLC_INCLUDES
#define DLC_RETRY_TIME 3
/* retry time in seconds - must be 0<=x<=32767 */
#define DLC_MAX_TRIES 10
#define DLC_MAX_OUTSTANDING 15
#define DLCDATASIZE 350 /* max size of data fields */
#define ADDRSIZE 9*7
#define DEFAULT_DLC_PEER 0x01
/* if we initiate dlc reset, call
the guy with this address */
#define GLOBALDLC 0xFF /* global dlc address */
/* show state changes */
#define DLC_EVENT_TRACE FALSE
struct dlc_frame_struct { /* structure of dlc frames */
byte cmd ; /* command */
byte data[ DLCDATASIZE ] ; /* data field */
byte nul1,nul2; /* these NULL fields take note
of bytes used by addrsg scheme
and should disappear when
this stuff is replaced w/ a
union template */
};
struct dl_data_struct { /* structure holding pktzd tx data*/
/* byte dest, src; */
word len ; /* for linked list */
struct dl_data_struct *next ; /* linked list - next pkt */
byte data[ DLCDATASIZE ] ;
};
/* structure controls all aspects of a particular DLC interface,
specifically DLC for .lcn */
struct dlccb_struct {
byte dlc_peer_addr ; /* other fella's dlc address */
byte dlc_state ; /* state of dlc link */
byte dlctxseq, dlcrxseq ; /* seq #'s */
byte retry_count, outstanding ; /* curr retry cnt, # tx outs */
int timer ;
struct dl_data_struct dl_next ; /* dummy hdr */
};
/* structure used by dlc state tables */
struct dlc_state_entry {
/* handler for the state */
void (*action_handler) (struct dlccb_struct *,
struct dlc_frame_struct *, word );
byte newstate ; /* new state */
};
/**** states
Note that states must start at state 1! ****/
#define DNSTATES 4
#define DNEVENTS 9
/* states */
#define DLIDLE 1
#define DLRESET 2
#define DLDATA 3
#define DLDWAIT 4
/** events **/
#define D_RX_RESET 0
#define D_RX_RESET_ACK 1
#define D_RX_DATA 2
#define D_ALL_ACK 3
#define D_TIMERX 4
#define D_Q_DATA 5
#define D_LSTART 6
#define D_RETRYX 7
#define D_RX_ACK 8
#endif